<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserGradeLogTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_grade_log', function (Blueprint $table) {
            $table->increments('log_id')->comment('主键ID');
            $table->unsignedInteger('user_id')->default(0)->comment('用户ID');
            $table->unsignedInteger('old_grade_id')->default(0)->comment('变更前的等级ID');
            $table->unsignedInteger('new_grade_id')->default(0)->comment('变更后的等级ID');
            $table->unsignedTinyInteger('change_type')->default(10)->comment('变更类型(10后台管理员设置 20自动升级)');
            $table->string('remark', 500)->nullable()->default('')->comment('管理员备注');
            $table->unsignedInteger('store_id')->default(0)->index('store_id')->comment('商城ID');
            $table->unsignedInteger('create_time')->default(0)->comment('创建时间');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_grade_log');
    }
}
